<?php

namespace App\Enums;

use App\Traits\EnumTrait;

class FeedbackStatusEnum
{
    use EnumTrait;

    const PENDING = ['status' => 0, 'text' => "未处理"];
    const REPLIED = ['status' => 1, 'text' => "已回复"];

    public static function getEnumByStatus($status)
    {
        foreach (self::getConstants() as $constant) {
            if ($constant['status'] == $status) {
                return $constant;
            }
        }
        return null;
    }

    public static function getStatus($data)
    {
        return $data['status'];
    }

    public static function getText($data)
    {
        return $data['text'];
    }

    public static function getStatusToText()
    {
        return array_column(self::getConstants(), 'text', 'status');
    }
}
